package com.ruoyi.framework.config;
import com.baomidou.mybatisplus.annotation.DbType;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
/**
 * Mybatis Plus 配置
 * 
 * @author liuz
 */
@EnableTransactionManagement(proxyTargetClass = true)
@Configuration
public class MybatisPlusConfig
{
	  /**
     * 分页插件
     */
    @Bean
    public MybatisPlusInterceptor paginationInnerInterceptor() {

        MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
        //声明针对分页的拦截器
        PaginationInnerInterceptor pageInterceptor = new PaginationInnerInterceptor();
        //声明数据库类型
        pageInterceptor.setDbType(DbType.MYSQL);
        //添加到拦截器链中
        interceptor.addInnerInterceptor(pageInterceptor);
        return interceptor;
    }
}